package database_interaction;

import java.sql.Time;
import java.util.Date;

/**
 * @file SQLDateTime.java
 * @version 0.1
 * @author James Dibble 10009689
 */
public class SQLDateTime {
    // <editor-fold defaultstate="collapsed" desc="Attributes">
    private Date _date;
    private Time _time;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Constructors">
    /**
     * Instance of a MySQL date.
     * @param date
     * @param time 
     */
    public SQLDateTime(Date date, Time time) {
        this._date = date;
        this._time = time;
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    /**
     * Get the datetime stamp in a MySQL format YYYY-MM-DD hh:mm:ss
     * 
     * @return MySQL format datetime.
     */
    @Override
    public String toString(){
        return String.format("%s-%s-%s %s",
                            _date.getYear(),
                            _date.getMonth(),
                            _date.getDay(),
                            _time.toString());
    }
    // </editor-fold>
}
